<template>
  <view class="container">
		<nav-ber :title="'我的对账单'" :bgColor="'#f7f8ff'"></nav-ber>
		<view class="tab_flex" style="border-bottom: 1px solid gainsboro;">
			<view class="th">任务</view>
			<view class="th">省份</view>
			<view class="th">完成任务数</view>
			<view class="th">获得积分</view>
		</view>
		<view class="province">
			<view class="tab_flex" v-for="(item, index) in datasList" :key="index">
				<view class="tr">{{ item.task }}</view>
				<view class="tr">{{ item.province }}</view>
				<view class="tr">{{ item.quantity }}</view>
				<view class="tr">{{ item.integral }}</view>
			</view>
		</view>
		<view class="bottom_w" v-if="bottonisShow">
			<u-button @click="lookFun" type="primary" text="确定"></u-button>
		</view>
		
  </view>
</template>
<script>
		import { finAccountCheckById, finAccountCheckconfirm } from '@/api/myStatement.js'
  export default {
    data() {
			return {
				keyword: '',
				ispro: '1',
				bottonisShow: true,
				datasList: []
			}
    },
		onLoad: function (option) { //option为object类型，会序列化上个页面传递的参数
				console.log('发送14',option); 
				if(option.type == 1){
					this.bottonisShow = false
				}
				this.Id = option.id
				this.finAccountCheckByIdFun()
//打印出上个页面传递的参数。传递的是id=1，则获取到的就是option.id
		},
		methods: {
			finAccountCheckByIdFun() {
				finAccountCheckById(this.Id).then((res) => {
					console.log('fasg22', res)
					this.datasList = res.data.itemList
					this.datas = res.data
				})
			},
			lookFun() {
				finAccountCheckconfirm({
					...this.datas,
					status: 3
				}).then((res) => {
					uni.showToast({
						title: '已确认',
						icon: "none",
						duration: 2000,
					})
					this.finAccountCheckByIdFun()
				})
			},
			gotoStamenFun() {
				uni.navigateTo({
					url: "/pages/personalCenter/statementDetails/index"
				})
			},
			proFun(val) {
				this.ispro = val
			}
		}
  }
</script>
<style lang="scss" scoped>
	.container {
		background-color: #f7f8ff;
		display: flex;
		flex-direction: column;
		height: 100vh;
		overflow: hidden;
	}
	.province {
		flex: 1;
		overflow: scroll;
		padding: 0 20rpx;
		margin-top: 20rpx;
	}
	.tab_flex {
		display: flex;
		padding: 20rpx 0rpx;
		box-sizing: border-box;
		.th {
			font-weight: 900;
			flex: 1;
			text-align: center;
			font-size: 30rpx;
		}
		.tr {
			flex: 1;
			text-align: center;
			font-size: 27rpx;
		}
	}
	.bottom_w {
		margin: 20rpx 50rpx;
		border-radius: 10rpx;
		overflow: hidden;
	}
</style>
